package org.softmed.rest.generation.xml.manager;

import java.util.HashMap;
import java.util.Map;
import org.softmed.persistence.PersistenceManager;
import org.softmed.rest.config.Application;
import org.softmed.rest.generation.xml.XMLMarshaller;

public class GenericToXML {

	static Map<String, XMLMarshaller> marshallers = new HashMap<String, XMLMarshaller>();
	XMLMarshaller marshaller;

	public GenericToXML(String choice) {
		marshaller = marshallers.get(choice);
		if (marshaller != null)
			marshaller = marshaller.clone();
	}

	public String toXML(Object obj, PersistenceManager util, Application app,
			Object... options) throws Throwable {
		return marshaller.toXML(obj, util, app, options);
	}

	public static Map<String, XMLMarshaller> getMarshallers() {
		return marshallers;
	}

}
